package ginx

import (
	"github.com/gin-gonic/gin"
	"github.com/google/uuid"
)

const (
	XRequestId = "X-Request-Id"
)

type loggerKey struct{}

// GenerateMsgIDFromContext 生成msgID
func GenerateMsgIDFromContext(c *gin.Context) string {
	requestId := c.GetHeader(XRequestId)
	if requestId == "" {
		requestId = uuid.New().String()
		c.Header(XRequestId, requestId)
	}
	return requestId
}


